<?php

require_once 'classes/LightPressPlugin.php';

class ArchivesList extends LightPressPlugin {
    
    var $constructor_args = array();
    var $default_context = LP_CONTEXT_ALL;
    var $description = 'Display archive months';
    
    var $active = true;
    var $hooks = array('sidebar');
    
    function ArchivesList(&$frontend, $args, $dummy_run=false) {
        $this->LightPressPlugin($frontend, $args, $dummy_run);
    }
    
    function run($hook, &$hook_data) {
        $f =& $this->_frontend;
        $tpl =& $f->tpl;
        $db =& $f->db;
        
        $archives =& $this->_frontend->getArchives();
        
        if (count($archives) == 0)
            return $this->hide();
        
        $tpl->setFile('plugin_archiveslist', 'plugins/archives_list.xml');
        
        $tpl->parseBlock(
            'PLUGIN_ARCHIVESLIST_ARCHIVE',
            'plugin_archiveslist_archive',
            $archives,
            'plugin_archiveslist');

        $tpl->parse('PLUGIN_ARCHIVESLIST', 'plugin_archiveslist');
    }
    
}

?>